package com.gdufe.firesafe.utils;

import org.springframework.web.servlet.mvc.method.annotation.SseEmitter;

import java.util.HashMap;
import java.util.Map;

public class MessageEmitterManager {
    public static Map<Integer, SseEmitter> emitterMap = new HashMap<>();

    public static SseEmitter get(Integer userId) {
        return emitterMap.get(userId);
    }

    public static SseEmitter newEmitter(Integer userId) {
        SseEmitter emitter = new SseEmitter(0L);
        emitterMap.put(userId, emitter);
        return emitter;
    }
}
